<template>
  <div class="add_con_form tl" v-loading="loading">
    <el-dialog :close-on-click-modal="false" title="是否券商" :modal-append-to-body="false" :visible.sync="visible" :show="show"
        :before-close="closeDialog" @close="$emit('update:show', false)" class="tl size_13" width="800px">
      <el-form :model="data" :rules="dataYZ" ref="data" class="mar_top" label-width="120px">
        <el-form-item label="会员账号">
          <el-col :span="12">
            <el-input :rows="4" :placeholder="this.editUser" :disabled="true" clearable></el-input>
          </el-col>
        </el-form-item>

        <el-form-item label="是否券商">
          <el-col :span="12">
            <el-radio v-model="data.is_broker" label="0">否</el-radio>
            <el-radio v-model="data.is_broker" label="1">是</el-radio>
          </el-col>
        </el-form-item>

        <div class="mar_bottom_15">
          <span class="sizeColor size_13 sp_style"></span>
          <el-button :loading="$store.state.isLoading" size="medium" type="primary" @click.prevent="addUpdate('data')">确定</el-button>
        </div>
      </el-form>
    </el-dialog>
  </div>
</template>

<style lang="less" scoped></style>

<script>
export default {
  data () {
    return {
      value: "",
      data: {
        id: "",
        is_live: null
      },
      loading: false,
      dataYZ: {},
      visible: this.show,
      fileList: []
    };
  },
  props: {
    show: Boolean,
    editId: String,
    editUser: String,
    is_supplier: String,
    clickNum: Number,
    row: Object
  },
  components: {},
  methods: {
    closeDialog () {
      this.visible = false;
    },
    addUpdate (formName) {
      this.isDisable = true;
      setTimeout(() => {
        this.isDisable = false;
      }, 3000);
      this.$refs[formName].validate(valid => {
        if (valid) {
          var params = {};
          params["id"] = this.data.id;
          params["is_broker"] = this.data.is_broker;
          this.$api.getUser.quan_edit(params).then(res => {
            if (res.data.code == 200 && res.data.result != null) {
              this.$emit("parent", "这里刷新父页面");
              this.$fnc.alertSuccess({ text: "编辑成功" }); //成功弹出框
              this.visible = false;
            } else {
              this.$fnc.alertError(res.data.result); //失败弹出框
            }
          });
        }
      });
    },
    onSuccess (pic) {
      this.data.shop_logo = pic;
    }
  },
  watch: {
    show () {
      this.visible = this.show;
    },
    clickNum (id) {
      // this.data = this.row;
      this.data.id = this.row.id;
      this.data.is_live = this.row.is_live;
    }
  },
  mounted () { },
  created () { }
};
</script>
